// @Author EthanScriptOn
// @Desc
package result_collector

import (
	"fmt"
	"gitee.com/fatzeng/srf_switch_stream_bridge/bridge"
	"gitee.com/fatzeng/srf_switch_stream_bridge/framework/actuator"
)

type DefaultBridgeResultCollector struct{}

func GenerateDefaultBridgeResultCollector() *DefaultBridgeResultCollector {
	return new(DefaultBridgeResultCollector)
}

func (d *DefaultBridgeResultCollector) CollectResult(ctx *actuator.SrfSwitchBridgeActuatorContext, config *bridge.BridgeConfig, response interface{}) (err error) {
	if response == nil {
		_ = ctx.Record(actuator.ResultCollection, fmt.Sprintf("response is nil"))
		return
	}
	ctx.SaveResponse(config.MultiChannelDataOperatorIdentifier, response)
	return
}
